Convert.ToJSON(Object[, Formatting])
Converts a JSON object back into a formatted JSON string.
Applies To
Description
Converts a JSON object back into a formatted JSON string. This is used if you would like to store a JSON object in a DEACOM field in the database. Using Convert.ToJSON() is a good way to convert a JSON object into text and store in a system constant or other memo field.
Properties and Methods
None
Available
The .ToJSON(Object[, Formatting]) method is available in:
-
16.00.021
-
All newer builds
Type
String
Syntax
Convert.ToJSON(Object[, Formatting]);
Parameters
|
Parameter |
Required |
Description |
|---|---|---|
|
Object |
Yes |
A Valid JSON object |
| Formatting | No | Numerical. 0 no formatting, 1 indentation. This is available starting in 17.02 and newer builds |
Example
var loObj = {"First Name": "John", "Last Name": "Smith", "Age": 31, "Zip": 19468};
Event.Form.MessageBox('loObj: ' + Convert.ToJSON(loObj));
/* Expected System Prompt Display:
loObj: {"First Name":"John","Last Name":"Smith","Age": 31,"Zip":19468}
*/